package com.ttg.web.dao.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ttg.model.mapper.QyyxDepositAccountDetailMapper;
import com.ttg.model.pojo.QyyxDepositAccountDetail;
import com.ttg.web.dao.QyyxDepositAccountDetailDao;
import org.springframework.stereotype.Repository;
import org.springframework.util.CollectionUtils;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository
public class QyyxDepositAccountDetailDaoImpl extends ServiceImpl<QyyxDepositAccountDetailMapper, QyyxDepositAccountDetail> implements QyyxDepositAccountDetailDao {

    /*@Override
    public Map<String, Long> existsMap(List<Map<String, String>> existsWhere) {
        if (CollectionUtils.isEmpty(existsWhere)) {
            return Collections.emptyMap();
        }
        Map<String, Long> rsMap = new HashMap<>();
        for (QyyxDepositAccountDetail qyyxDepositAccountDetail : baseMapper.existsMap(existsWhere)) {
            rsMap.put(qyyxDepositAccountDetail.getCstScId() + qyyxDepositAccountDetail.getAccountNo() + qyyxDepositAccountDetail.getAccountId(), qyyxDepositAccountDetail.getId());
        }

        return rsMap;
    }*/

    @Override
    public Map<String, Long> existsMap(List<String> existsWhere) {
        if (CollectionUtils.isEmpty(existsWhere)) {
            return Collections.emptyMap();
        }

        LambdaQueryWrapper<QyyxDepositAccountDetail> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper.in(QyyxDepositAccountDetail::getAccountId, existsWhere);
        Map<String, Long> rsMap = new HashMap<>();
        for (QyyxDepositAccountDetail qyyxDepositAccountDetail : list(lambdaQueryWrapper)) {
            rsMap.put(qyyxDepositAccountDetail.getAccountId(), qyyxDepositAccountDetail.getId());
        }
        return rsMap;
    }
}
